package demo7;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

public class Blackjack {
    /**
     洗牌
     1.向各玩家分别派发一张牌
     2.庄家发给自己一张牌
     3.向各玩家派第二张牌
     4.庄家再发给自己一张牌（不是所有赌场都会有这个步骤，大部分赌场都是在所有玩家结束要牌后才发第二张明牌给庄家）
     5.如果庄家明牌是A、荷官会询问玩家是否购买保险
     6.玩家可进行加注、投降、分牌等动作
     7.庄家逐位询问玩家是否加牌、直至闲家不加牌才询问下一位玩家，轮流询问玩家直至最后一位玩家加牌完成
     8.庄家如不足17点便需加牌直至超过或等于17点
     9.对未有爆牌的玩家，比点数大小，大者胜，可得赔金; 如庄家爆牌、未有爆牌的玩家便可得赔金
     10.回收已使用的牌及给小费
     */
    /**
     * 2-10 j q k A
     */
    public interface CommonCard{
        public List<Card> createCardForBlackJack();
    }
    public class BlackJackCard implements CommonCard{
        @Override
        public List<Card> createCardForBlackJack() {
            //
            return null;
        }
    }
    public class Card{
        private int card;
    }

    @Data
    public class Master {
        public Card oneCard;
        public Card twoCard;
        private int money;
        public Cart cart;
    }

    @Data
    public class Guest {
        private int money;
        public Card oneCard;
        public Card twoCard;
        public List<Card> otherCards = new ArrayList<Card>();
        public Cart cart;
    }
    @Data
    public class Cart{
        private int money;
    }
    public void run(){

        PlaceBetProcess placeBetProcess = new PlaceBetProcess();
        placeBetProcess.updateChip();

        BlackJackCard blackJackCard = new BlackJackCard();
        List<Card> cardForBlackJack = blackJackCard.createCardForBlackJack();
        // loop send card for SendCardProcess

        SendCardProcess sendCardProcess = new SendCardProcess();
        sendCardProcess.sendOneCardForGuest(null,null);
        OtherProcess otherProcess = new OtherProcess();
        otherProcess.plus(null,10);;
        otherProcess.surrender(null);
        otherProcess.division(null);
        CompareProcess compareProcess = new CompareProcess();
        compareProcess.compare();
        PaymentProcess paymentProcess = new PaymentProcess();
        paymentProcess.payment();
    }

    public class PlaceBetProcess {
        // 更新筹码 -> Cart
        public void updateChip(){}

    }

    // 1+2+3+4+5+6=21
    public class SendCardProcess {
        public void sendOneCardForGuest(Guest guest, Card card) {
            guest.setOneCard(card);
        }

        public void sendTwoCardForGuest(Guest guest, Card card) {
            guest.setTwoCard(card);
        }

        public void sendOthersCardForGuest(Guest guest, Card card) {
            guest.getOtherCards().add(card);
        }
    }

    //   6.玩家可进行加注、投降、分牌等动作
    public class OtherProcess {
        public void plus(Guest guest,int money) {
        }

        public void surrender(Guest guest) {
        }

        public void division(Guest guest) {
            //
        }
    }

    public class CompareProcess {
            public void compare(){
                // compare all human the sum of card.
            }
    }

    public class PaymentProcess {
        public void payment(){
            // Guest guestA,Guest guestB
            // get all guest info , to settlement

        }
    }
//     public class


}
